package com.AX.mapper;

import org.apache.ibatis.annotations.*;

@Mapper
public interface ParkingRecordMapper {
    @Insert("INSERT INTO parking_records " +
            "VALUES (#{recordId}, #{spaceId}, #{userId})")
    void insertRecord(String recordId,String spaceId,int userId);


    @Select("SELECT COUNT(*) FROM parking_records WHERE user_id = #{userId} AND space_id = #{spaceId}")
    int checkOwnership(@Param("userId") int userId, @Param("spaceId") String spaceId);

    @Delete("DELETE FROM parking_records WHERE space_id = #{spaceId} AND user_id = #{userId}")
    void deleteRecord(@Param("spaceId") String spaceId, @Param("userId") int userId);
}